<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<style>
    .v-enter-from {
        opacity: 0;
        transform: translateY(30px);
    }

    .v-enter-active {
        transition: all 2s ease-in;
    }

    .v-enter-to {
        opacity: 1;
        transform: translateY(0);
    }

    .item-list {
        display: inline-block;
    }
</style>

<body>
    <div id="app"></div>
</body>
<script>
    let demo = {
        template: `<div></div>`
    }
    let vm = {
        components: { demo },
        template: `
                    <div>
                        <transition-group>
                            <span v-for="(item,index) in list" :key="index" class="item-list">
                                {{item}}
                            </span>
                        </transition-group>
                        <hr>
                        <button @click="add">添加</button>
                    </div>
                    `,
        methods: {
            add () {
                this.list.unshift(this.list.length + 1)
            }
        },
        data () {
            return {
                list: []
            }
        },

    }
    Vue.createApp(vm).mount('#app')
</script>

</html>